package com.stlm2.quartz;


import com.stlm2.dems.service.CommissionService;
import com.stlm2.dems.service.GoodsOrderService;
import com.stlm2.dems.service.SeckillGoodsService;
import com.stlm2.dems.service.ShopOrderService;
import org.quartz.JobExecutionContext;

import javax.annotation.Resource;

public class QuartzJobs {

    @Resource
    private ShopOrderService shopOrderService;
    @Resource
    private GoodsOrderService goodsOrderService;
    @Resource
    private SeckillGoodsService seckillGoodsService;


   public void every10Minute(JobExecutionContext context) {
        /*
        * 取消一天之前未支付的订单  每十分钟执行一次
        * ffl
        *2017-11-14 16:37:31
        * */
//        System.out.println("取消一天之前未支付的订单--执行开始");
//        shopOrderService.cancelOrder();
//        System.out.println("取消一天之前未支付的订单--执行结束");

       shopOrderService.cancelOrderThread();
    }


    public void every10Minute2(JobExecutionContext context) {
        /*
        * 取消十分钟之前未支付的秒杀订单  每十分钟执行一次
        * ffl
        *2017-12-29 14:23:36
        * */
        seckillGoodsService.cancelOrderThread();

    }


    public void confirmReceiptOrder(JobExecutionContext context) {
        /*
        * 更改发货7天后还未更改确认收货的订单为确认收货  每六小时执行一次
        * ffl
        *2017-11-14 16:37:31
        * */
//        System.out.println("改发货7天后还未更改确认收货的订单为确认收货--执行开始");
//        shopOrderService.confirmReceiptOrder();
//        System.out.println("改发货7天后还未更改确认收货的订单为确认收货--执行结束");
        shopOrderService.confirmReceiptOrderThread();


    }
    public void finishOrder(JobExecutionContext context) {
        /*
        *  确认收货14天后订单完成 每六小时执行一次
        * ffl
        *2017-11-14 16:37:31
        * */
//        System.out.println("确认收货14天后订单完成 --执行开始");
//        goodsOrderService.finishOrder();
//        System.out.println("确认收货14天后订单完成 --执行结束");
        goodsOrderService.finishOrderThread();


    }

    public void partnerCommission(JobExecutionContext context) {
        /*
        *  合伙人分佣   每月2号凌晨5点 执行一次
        * ffl
        *2017-11-14 16:37:31
        * */
        System.out.println("合伙人分佣  --执行开始");
        // commissionService.partnerLevelCommission();
        System.out.println("合伙人分佣  --执行结束");


    }
}
